﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using Common.Logging;
using WuDada.Core.SystemApplications.Domain;
using System.Web;
using WuDada.Core.SystemApplications;
using WuDada.Core.SystemApplications.Service;

public partial class admin_UC07_0711 : System.Web.UI.Page
{
    private ILog m_Log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
    private SystemFactory m_SystemFactory;
    private ISystemService m_SystemService;
    private WebLogService m_WebLogService;

    //SystemId m_Mode=1
    private int m_Mode = 1;

    protected void Page_Load(object sender, EventArgs e)
    {
        m_WebLogService = new WebLogService();
        m_SystemFactory = new SystemFactory();
        m_SystemService = m_SystemFactory.GetSystemService();

        if (!IsPostBack)
        {
            ShowMode();
            LoadVOToUI();
        }
    }

    private void ShowMode()
    {
        if (m_Mode == 0)
        {
            btnSave.Visible = false;

        }
        else
        {
            btnSave.Visible = true;

        }
    }

    private void LoadVOToUI()
    {
        SystemParamVO systemParamVO = m_SystemService.GetSystemParamById(m_Mode);
        UIHelper.FillUI(pnlContent, systemParamVO);
    }

    protected void btnSave_Click(object sender, EventArgs e)
    {
        SystemParamVO systemParamVO = m_SystemService.GetSystemParamById(m_Mode);
        UIHelper.FillVO(pnlContent, systemParamVO);
        m_SystemService.UpdateSystemParam(systemParamVO);
        m_WebLogService.AddSystemLog(MsgVO.Action.修改, systemParamVO);
        ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "js", JavascriptUtil.AlertJS(MsgVO.UPDATE_OK), false);
    }
}


